home *** CD-ROM | disk | FTP | other *** search
- property musicList, curMusic, soundChn, lastRoll, fadingout, curVol, inc, fadeOutDone, soundVol, musicSpritesList
-
- on beginSprite me
- musicList = [#rl: "coas", #coast: "Locate", #sub: "rura", #urb: "urba"]
- musicSpritesList = [:]
- repeat with thisRegion in [#urb, #sub, #rl, #coast]
- thisSprite = sendAllSprites(#getRegion, thisRegion)
- setaProp(musicSpritesList, thisSprite, thisRegion)
- end repeat
- soundChn = 1
- soundVol = the volume of sound soundChn
- curVol = soundVol
- inc = 15
- end
-
- on exitFrame me
- thisRoll = 0
- if modalWindowUp() then
- go(the frame)
- exit
- end if
- repeat with x = 1 to 4
- thisSprite = getPropAt(musicSpritesList, x)
- if rollover(thisSprite) then
- if thisSprite = lastRoll then
- go(the frame)
- exit
- next repeat
- end if
- curRegion = getAt(musicSpritesList, x)
- curMusic = musicList[curRegion]
- rollSprite = thisSprite
- lastRoll = thisSprite
- exit repeat
- end if
- end repeat
- if rollSprite = 0 then
- if lastRoll <> rollSprite then
- fadingout = 1
- lastRoll = rollSprite
- go(the frame)
- exit
- end if
- if fadeOutDone then
- sound(soundChn).stop()
- set the volume of sound soundChn to soundVol
- curVol = soundVol
- fadingout = 0
- go(the frame)
- exit
- end if
- if fadingout then
- curVol = curVol - inc
- if curVol < 0 then
- curVol = 0
- fadeOutDone = 1
- end if
- set the volume of sound soundChn to curVol
- go(the frame)
- exit
- end if
- go(the frame)
- exit
- end if
- if soundBusy(soundChn) then
- sound(soundChn).stop()
- end if
- sound(soundChn).setPlayList([])
- sound(soundChn).queue([#member: member(curMusic), #preloadTime: 1000])
- sound(soundChn).play()
- fadeOutDone = 0
- fadingout = 0
- set the volume of sound soundChn to soundVol
- curVol = soundVol
- go(the frame)
- end
-